package apof.dao.remote
{
	import flash.net.URLRequest;
	import flash.net.URLLoader;
	import flash.net.URLVariables;
	import apof.model.User;
	import apof.dao.remote;
	import apof.dao.remote.httpSendUrl;
	import apof.dao.remote.httpRequestUrl;
	import mx.rpc.events.ResultEvent;
	import apof.dao.remote.Service;
	
	public class RemoteAccessor implements RemoteAccess
	{
		private var request:URLRequest = new URLRequest({httpRequestUrl});
		private var sender:URLRequest = new URLRequest({httpSendUrl});
		private var loader:URLLoader = new URLLoader();
		private var variables:URLVariables = new URLVariables();
		
		public function send(data:XML):void
		{
			/**
			 *  request.setLoginCredentials(uid,password);
			 **/
			 variables.data=data;
			 sender.data=variables;
			 loader.load(sender);
		}
		
		public function request(args:XML, callback:function)
		{
			/**
			 *  request.setLoginCredentials(uid,password);
			 **/
			variables.data=args;
			request.data=variables;
			loader.addEventListener(Event.COMPLETE,callback(loader.data));
			loader.load(request);
		}
		
	}
}